﻿<%namespace YouHP.Model%>
<%namespace YouHP.BLL%>
<%namespace YouHP.Utility%>
<%namespace System.Collections.Generic%>
<%template _header%>
<style>
.log_comment_list .bar
{
	background:#FFFBE0 none repeat scroll 0 0;
border-bottom:1px solid #CCCCCC;
border-top:1px solid #CCCCCC;
padding:1px 10px;
}
.log_comment_list span
{
	color:#949494
}
.log_comment_list .content
{
	padding:10px 20px;
	overflow:hidden;
	border-bottom:1px solid #D8DFEA;
	zoom:1;
}
.log_comment_list a:link, .log_comment_list a:visited
{
	color:Green!important;
	text-decoration:underline;
}
.log_comment_list .img
{
  width:100px;
  text-align:center;
  float:left;
}
.log_comment_list .log
{
	float:left;
	width:150px;

	background:#F7F8FB none repeat scroll 0 0;
border:1px solid #D0D5DF;
color:#999999;
margin-left:20px;
padding:7px;
}
.log_comment_list .comment
{
 border-left:1px solid #D8DFEA;
 margin-left:10px;
 padding:5px;
 width:470px;
 float:left;
}
.log_comment_list .comment .replylist
{
	margin-top:10px;
	border-top:1px solid #D8DFEA;
	padding:10px 0px;
	 width:420px;
}


</style>
<script  type="text/javascript">
function replyLogComment(logCommentId)
{
    var e1 = document.getElementById('replybox_'+logCommentId); 
    var e2 = document.getElementById('replycontent_'+logCommentId); 
    e1.style.display = 'block';
    e2.focus();

 }
 function replyCancell(logCommentId)
{
    var e1 = document.getElementById('replybox_'+logCommentId); 
    var e2 = document.getElementById('replycontent_'+logCommentId); 
    e1.style.display = 'none';
    e2.value = "";
}

function LogCommentReplyAdd(logId,logCommentId)
{

    var replycontent = $("replycontent_"+logCommentId).value;
    if (replycontent.length == 0)
    {
        alert("回复内容不能为空！");
        return;
    }
    if(replycontent.length > 300 ) 
    {
        alert("回复内容不能超过300个字！");
        return;
    }
  
  $("reply_submit_"+logCommentId).disabled = true;
  var aurl = "/Pages/alpha/Ajax/LogCommentReplyAdd.aspx"+"?lid="+logId+"&parentId="+logCommentId+"&reply="+replycontent.escUrl();
  var myAjax=new Ajax(aurl,
  {
     method:'post',
     onComplete:function()
     {
          var html=this.response.text;
          $("replylist_"+logCommentId).innerHTML += html;
          $("replycontent_"+logCommentId).value="";
          $("reply_submit_"+logCommentId).disabled = false;
          $("replybox_"+logCommentId).style.display = "none";
      }
   }
   );
   myAjax.request();
  
  
}

</script>
<div class="layout-cols2">
<%template _memmenu%>
	<div class="pannelcontent">

		<div class="pcontent">
		<div class="panneldetail">
			<div class="panneltabs">
	           <%template _logmenu%>
			</div>	
          <div class="pannelbody">


	<%if IsPost%>
		<%template _msgbox%>
	<%else%>

        <div class="log_comment_list">

            <%csharp%>
            foreach(LogCommentInfo item in LogCommentDataList)
            {
            <%/csharp%>
            <%csharp%>TempUrl = item.PostTime.ToString("yyyy-MM-dd hh:mm");<%/csharp%>
            <div class="bar">
            <div style="float:right;"><span>{TempUrl}</span></div>
             <%csharp%>TempUrl="/Profile/Index.aspx?uid="+item.PostUserId;<%/csharp%>
            <div><a href="{this.GetUrl(TempUrl)}">{item.PostUserName}</a>对我的日志评论道：</div>
            </div>
            <div class="content">
            <div class="img">
            <a href="{this.GetUrl(TempUrl)}"><img alt="头像" src="{UserBLL.Instance.GetUserInfo(item.PostUserId).Avatar}" width="50px" height="50px" /></a>
            <img alt="" src="/support/alpha/images/wgbr_l.gif" />
            
            </div>
            <%csharp%> TempUrl="/User/Log.aspx?lid="+item.LogTopicId;<%/csharp%>
            <div class="log">
            <a href="{this.GetUrl(TempUrl)}">{item.LogTitle}</a>
            <%csharp%>TempUrl = item.LogPostTime.ToString("yyyy-MM-dd hh:mm");<%/csharp%>
            <p><span>发于{TempUrl}</span></p>
            
            </div>
            
             <div class="comment">
             {item.Body}
             
             <div class="replylist" id="replylist_{item.Id}">
             <%csharp%>
             List<LogCommentInfo> LogCommentReplyList = LogCommentBLL.Instance.GetLogCommentReplyList(item.Id);
             foreach(LogCommentInfo info in LogCommentReplyList){
             <%/csharp%>
             <div class="reply_item">
             <%csharp%>TempUrl = info.PostTime.ToString("yyyy-MM-dd hh:mm");<%/csharp%>
             <div style="float:right;"><span>{TempUrl}</span></div>
             <div>
             <img alt="头像" src="{UserBLL.Instance.GetUserInfo(info.PostUserId).Avatar}" width="25px" height="25px" />
              <%csharp%>TempUrl="/Profile/Index.aspx?uid="+info.PostUserId;<%/csharp%>
              &nbsp;&nbsp;<a href="{this.GetUrl(TempUrl)}">{info.PostUserName}</a><span>的回复</span>：
             <div style="margin-left:40px;">{info.Body}</div>
             </div>
             
             </div>
            <%csharp%>}<%/csharp%>
             
             </div>
             <div><a  href="javascript:replyLogComment({item.Id});"><span>回复</span></a>&nbsp;&nbsp;<a href="javascript:if(window.confirm('确定删除该评论和其所有回复？')) $('submit_data').submit();"><span>删除</span></a></div>
             
              <div id="replybox_{item.Id}" style="display:none;margin-top:10px;">
              <textarea name="replycontent_{item.Id}"id="replycontent_{item.Id}" width="300px" height="80px" cols="60" rows="6"></textarea>
              <div style="padding-left:130px">
              <input id="reply_submit_{item.Id}" type="button" value="回复" onclick="LogCommentReplyAdd({item.LogTopicId},{item.Id});">&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="取消" onclick="replyCancell({item.Id});";>
              </div>
              </div>

             </div>
            
            </div>
            <form action="" method="post"  id="submit_data">
               <input  type="hidden" value="{item.LogTopicId}" name="logId" />
               <input  type="hidden" value="{item.Id}" name="logCommentId" />
            </form>

           <%csharp%>
            }
           <%/csharp%>
             
         </div>
         
          <div class="pages">{PagingString}</div>
	<%/if%>
</div>
</div>
</div>
</div>
	
</div>


<%template _footer%>